<?php
/**
 * Created by PhpStorm.
 * User: 毛文科
 * Date: 2018/8/23 0023
 * Time: 15:12
 */
namespace app\admin\model;
use think\Db;

class ReleaseModel
{
    /**获取职位发布模型
     * @return $this
     */
    static public function getRelease(){
        return Db::view('post_release',true)
            ->view('company','company_name','company.id=post_release.company_id','left')
            ->view('departmen_table','departmen_name','departmen_table.id=post_release.department_id','left')
            ->view('position_table','position_name','position_table.id=post_release.position_id')
            ->view('user','nickname','user.id=post_release.userid');
    }

    /**添加职位发布
     * @param $data
     * @return int|string
     */
    static public function addRelease($data){
        return Db::name('post_release')->insert($data);
    }

    /**职位发布删除
     * @param $field
     * @param null $op
     * @param null $condition
     * @return int
     */
    static public function delRelease($field, $op = null, $condition = null){
        return Db::name('post_release')->where($field,$op,$condition)->delete();
    }

    /**职位发布更新
     * @param $data
     * @return int|string
     */
    static public function updateRelease($data){
        return Db::name('post_release')->update($data);
    }
}